#!/bin/bash

threads=8
duration="20s"
connections=200
baseURL="http://127.0.0.1:3000/"

task_names[0]="themesStocks"
task_names[1]="fiance"
task_names[2]="dKStockNugget"
task_names[3]="bannerList"
task_names[4]="sinaNews"
task_names[5]="checkToken"
task_names[6]="twoFilterStockNugget"
task_names[7]="hotSearch"
task_names[8]="userOptional"
task_names[9]="startAd"
task_names[10]="liveAd"
task_names[11]="homeAd"
task_names[12]="weekStocksPool"
task_names[13]="homeBannerList"

task_url[0]="fetch/sina/themesStocks"
task_url[1]="fetch/sina/fiance?symbol=sh000001&scale=30"
task_url[2]="fetch/sina/dKStockNugget"
task_url[3]="user/banner/list"
task_url[4]="fetch/sina/news?news=gg_sz002203,sz002203"
task_url[5]="check/user/token"
task_url[6]="fetch/sina/twoFilterStockNugget"
task_url[7]="fetch/stock/hotSearch"
task_url[8]="fetch/user/optional"
task_url[9]="start/ad/slot"
task_url[10]="live/ad/slot"
task_url[11]="home/ad/slot"
task_url[12]="fetch/sina/weekStocksPool"
task_url[13]="home/banner/list"

i=0
while [ $i -lt ${#task_names[@]} ];do
	# echo ${task_names[$i]}
	# echo ${task_url[$i]}
	# echo "wrk -t${threads} -c${connections} -d${duration} -s ./module/${task_names[$i]}.lua ${baseURL}${task_url[$i]}"	
	echo '\n'
  wrk -t${threads} -c${connections} -d${duration} -s ./module/${task_names[$i]}.lua ${baseURL}${task_url[$i]}	
	echo '\n'
  let i++
done

exit 0
